/**
 * (c) Copyright Ascensio System SIA 2025
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.zzvcom.office.entities;

import jakarta.persistence.FetchType;
import lombok.Getter;
import lombok.Setter;
import jakarta.persistence.Entity;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.Table;

import java.util.List;

/**
 * 权限实体类，用于定义文档或应用程序的各种权限控制
 * 继承自AbstractEntity，包含基本的实体属性
 */
@Entity
@Table(name = "permission")
@Getter
@Setter
public class Permission extends AbstractEntity {
    /**
     * 是否允许评论权限，默认为true
     */
    private Boolean comment = true;

    /**
     * 是否允许复制权限，默认为true
     */
    private Boolean copy = true;

    /**
     * 是否允许下载权限，默认为true
     */
    private Boolean download = true;

    /**
     * 是否允许编辑权限，默认为true
     */
    private Boolean edit = true;

    /**
     * 是否允许打印权限，默认为true
     */
    private Boolean print = true;

    /**
     * 是否允许填写表单权限，默认为true
     */
    private Boolean fillForms = true;

    /**
     * 是否允许提交表单权限，默认为true
     */
    private Boolean submitForm = true;

    /**
     * 是否允许修改过滤器权限，默认为true
     */
    private Boolean modifyFilter = true;

    /**
     * 是否允许修改内容控件权限，默认为true
     */
    private Boolean modifyContentControl = true;

    /**
     * 是否允许审阅权限，默认为true
     */
    private Boolean review = true;

    /**
     * 是否允许聊天权限，默认为true
     */
    private Boolean chat = true;

    /**
     * 是否允许使用模板权限，默认为true
     */
    private Boolean templates = true;

    /**
     * 审阅组列表，具有审阅权限的用户组
     */
    @ManyToMany(fetch = FetchType.EAGER)
    private List<Group> reviewGroups;

    /**
     * 评论查看组列表，具有查看评论权限的用户组
     */
    @ManyToMany(fetch = FetchType.EAGER)
    private List<Group> commentsViewGroups;

    /**
     * 评论编辑组列表，具有编辑评论权限的用户组
     */
    @ManyToMany(fetch = FetchType.EAGER)
    private List<Group> commentsEditGroups;

    /**
     * 评论删除组列表，具有删除评论权限的用户组
     */
    @ManyToMany(fetch = FetchType.EAGER)
    private List<Group> commentsRemoveGroups;

    /**
     * 用户信息组列表，具有查看用户信息权限的用户组
     */
    @ManyToMany(fetch = FetchType.EAGER)
    private List<Group> userInfoGroups;

    /**
     * 是否允许保护文档权限，默认为true
     */
    private Boolean protect = true;
}
